﻿<%@ Page Title="" Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true"
    CodeFile="RoleAssignment.aspx.cs" Inherits="Page_RoleAssignment" %>

<%@ Register Src="UserControl/ContentHeader.ascx" TagName="ContentHeader" TagPrefix="uc1" %>
<%@ Register Src="UserControl/Message.ascx" TagName="Message" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <uc1:ContentHeader ID="ContentHeader1" PageTitle="Permission Assignment" GoToLabel="User Management"
        GoToLink="UserListManagement.aspx" runat="server" />
    <div class="body_content">
        <uc2:Message ID="Message_Alert" runat="server" />
        <asp:UpdateProgress ID="UpdateProgress_Main" AssociatedUpdatePanelID="UpdatePanelContent"
            runat="server" DynamicLayout="true" DisplayAfter="0">
            <ProgressTemplate>
                <div class="overlay">
                    <div class="loader">
                        <img id="Img1" runat="server" alt="Loading..." src="../App_Themes/img_data/loading.gif"
                            width="25" />
                    </div>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UpdatePanelContent" runat="server" OnLoad="UpdatePanelContent_Load">
            <ContentTemplate>
                <div style="width: 20%; float: left">
                    <h3>
                        <%= Resources.SystemAccount.UserList%></h3>
                    <div class="formrow">
                        <div class="form_field fl">
                            <asp:TextBox ID="TextBox_UserName" runat="server" CssClass="textbox" Width="100"
                                MaxLength="70"></asp:TextBox>
                            <asp:Button ID="Button_Search" CssClass="button" runat="server" Text="Search" OnClick="Button_Search_Click" />
                            <asp:Button ID="Button_ViewAll" CssClass="button" runat="server" 
                                Text="View all" onclick="Button_ViewAll_Click" 
                                 />
                        </div>
                        <div class="clr">
                        </div>
                    </div>
                    <asp:ListBox ID="ListBox_UserList" Width="100%" Height="400" runat="server" ctedIndexChanged="ListBox_UserList_SelectedIndexChanged"
                        AutoPostBack="True" CssClass="select" OnSelectedIndexChanged="ListBox_UserList_SelectedIndexChanged">
                    </asp:ListBox>
                </div>
                <div style="width: 79%; float: right">
                    <div class="formrow">
                        <div class="form_field fr">
                            <asp:Button ID="Button_SaveAllTop" OnClick="Button_SaveAllButtom_Click" CssClass="button"
                                runat="server" Text="Save" />
                        </div>
                        <div class="clr">
                        </div>
                    </div>
                    <asp:Repeater ID="Repeater_ModuleList" runat="server" OnItemCommand="Repeater_ModuleList_ItemCommand"
                        OnItemDataBound="Repeater_ModuleList_ItemDataBound">
                        <HeaderTemplate>
                            <table width="100%" cellspacing="0" cellpadding="0" class="grid">
                                <tr>
                                    <th align="center" width="2%">
                                        <%= Resources.SystemAccount.No%>
                                    </th>
                                    <th>
                                        <%= Resources.SystemAccount.Page%>
                                    </th>
                                    <th width="6%" class="center">
                                        <%= Resources.SystemAccount.All%>
                                    </th>
                                    <th width="6%" class="center">
                                        <%= Resources.SystemAccount.View%>
                                    </th>
                                    <th width="6%" class="center">
                                        <%= Resources.SystemAccount.Add%>
                                    </th>
                                    <th width="6%" class="center">
                                        <%= Resources.SystemAccount.Edit%>
                                    </th>
                                    <th width="6%" class="center">
                                        <%= Resources.SystemAccount.Delete%>
                                    </th>
                                    <th width="6%" class="center">
                                        <%= Resources.SystemAccount.Deny%>
                                    </th>
                                </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr class="odd" id='<%# "tr"+ (Container.ItemIndex + 1).ToString() %>'>
                                <td align="center">
                                    <%# Container.ItemIndex + 1 %>
                                </td>
                                <td>
                                    <%# Eval("ModuleName")%>
                                    <asp:Literal ID="Literal_ID" Visible="false" Text='<%# Eval("ModuleID") %>' runat="server"></asp:Literal>
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_All" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_Isview" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsAdd" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsEdit" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsDelete" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsDeny" runat="server" />
                                </td>
                            </tr>
                        </ItemTemplate>
                        <AlternatingItemTemplate>
                            <tr class="even" id='<%# "tr"+ (Container.ItemIndex + 1).ToString() %>'>
                                <td align="center">
                                    <%# Container.ItemIndex + 1 %>
                                </td>
                                <td>
                                    <%# Eval("ModuleName")%>
                                    <asp:Literal ID="Literal_ID" Visible="false" Text='<%# Eval("ModuleID") %>' runat="server"></asp:Literal>
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_All" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_Isview" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsAdd" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsEdit" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsDelete" runat="server" />
                                </td>
                                <td align="center">
                                    <asp:CheckBox ID="CheckBox_IsDeny" runat="server" />
                                </td>
                            </tr>
                        </AlternatingItemTemplate>
                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                    <div class="formrow">
                        <div class="form_field fr margin0">
                            <asp:Button ID="Button_SaveAllButtom" CssClass="button" runat="server" Text="Save"
                                OnClick="Button_SaveAllButtom_Click" />
                        </div>
                        <div class="clr">
                        </div>
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div class="clr">
    </div>
    <script type="text/javascript" language="javascript">
        function Check(id) {
            var idlist = id.split(';');
            var checked = $("#" + idlist[0]).attr("checked");
            $("#" + idlist[1]).attr("checked", checked);
            $("#" + idlist[2]).attr("checked", checked);
            $("#" + idlist[3]).attr("checked", checked);
            $("#" + idlist[4]).attr("checked", checked);
            $("#" + idlist[5]).attr("checked", false);
        }
        function UnCheck(id) {
            var idlist = id.split(';');
            $("#" + idlist[0]).attr("checked", false);
            $("#" + idlist[1]).attr("checked", false);
            $("#" + idlist[2]).attr("checked", false);
            $("#" + idlist[3]).attr("checked", false);
            $("#" + idlist[4]).attr("checked", false);
        }
        function CheckOne(id) {
            var idlist = id.split(';');
            var checked = $("#" + idlist[0]).attr("checked");
            var view = $("#" + idlist[1]).attr("checked");
            var add = $("#" + idlist[2]).attr("checked");
            var edit = $("#" + idlist[3]).attr("checked");
            var deleteval = $("#" + idlist[4]).attr("checked");
            if (view && add && edit && deleteval) {
                $("#" + idlist[0]).attr("checked", true);
            }
            else {
                $("#" + idlist[0]).attr("checked", false);
                $("#" + idlist[5]).attr("checked", false);
            }
        }
    </script>
</asp:Content>
